package mysql

import "gorm.io/gorm"

type Goods struct {
	gorm.Model
	GoodsTitle  string  `gorm:"varchar(30);not null;"`
	GoodsPrice  float64 `gorm:"decimal(10,2);not null;"`
	GoodsImg    string  `gorm:"varchar(255);not null;"`
	GoodsStatus int64   `gorm:"int;default:1;noy null;"`
	GoodsStock  int64   `gorm:"int;default:1;not null;"`
}

func (g *Goods) Create() error {
	return DB.Debug().Create(&g).Error
}
func (g *Goods) FindGoods(goodsId int64) error {
	return DB.Debug().Where("id=?", goodsId).Find(&g).Error
}
